#! /bin/sh
#
# Name: rcS 
# Date: 2003-06-20 17:35
# Author: MontaVista Software, Inc. <source@mvista.com>
# Copyright: Copyright(C) 1999-2003 MontaVista Software, Inc.
# License: 2003 (c) MontaVista Software, Inc. This file is licensed
#          under the terms of the GNU General Public License version 2.
#          This program is licensed "as is" without any warranty of any
#          kind, whether express or implied.
# 
# Copyright 2002, 2003, 2004 Sony Corporation
# Copyright 2002, 2003, 2004 Matsushita Electric Industrial Co., Ltd.
#
### BEGIN INIT INFO
# Short-Description: Call all ??* scripts in /etc/rcS.d
# Description: Call all S??* scripts in /etc/rcS.d in numerical/alphabetical order.
### END INIT INFO 

# Init script information
INIT_NAME=rcS
DESC=""

# Individual Daemon information
DAEMON1=
ARGS1=
BASENAME1=${DAEMON1##*/}

# Load init script configuration
[ -f /etc/default/$INIT_NAME ] && . /etc/default/$INIT_NAME

# Source the init script functions
. /etc/init.d/init-functions

PATH=/sbin:/bin:/usr/sbin:/usr/bin
runlevel=S
prevlevel=N
umask 022
export PATH runlevel prevlevel

#
#	See if system needs to be setup. This is ONLY meant to
#	be used for the initial setup after a fresh installation!
#
if [ -x /sbin/unconfigured.sh ]
then
  /sbin/unconfigured.sh
fi

#
#	Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
#
trap ":" INT QUIT TSTP

#
#	Call all parts in order.
#
for i in /etc/rc.d/rcS.d/S??*
do
	# Ignore dangling symlinks for now.
	[ ! -f "$i" ] && continue

	case "$i" in
		*.sh)
			# Source shell script for speed.
			(
				trap - INT QUIT TSTP
				INIT_NAME=$1
				set start
				. $i
				unset INIT_NAME
			)
			;;
		*)
			# No sh extension, so fork subprocess.
			INIT_NAME=$INIT_NAME $i start
			;;
	esac
done
#	Run /etc/rc.d/rc.local if it exists
[ -x /etc/rc.d/rc.local ] && /etc/rc.d/rc.local

#
#	Finish setup if needed. The comment above about
#	/sbin/unconfigured.sh applies here as well!
#
if [ -x /sbin/setup.sh ]
then
  /sbin/setup.sh
fi

